Skip to content

[pull] main from tldraw:main#489

Merged
pull[bot] merged 1 commit intocode:mainfrom
tldraw:main
Apr 9, 2026
Merged

[pull] main from tldraw:main#489
pull[bot] merged 1 commit intocode:mainfrom
tldraw:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Apr 9, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

In order to give AI agents more flexible and powerful control over the
tldraw canvas, this PR replaces the old server-side shape CRUD tools
(create_shapes, update_shapes, delete_shapes) with an exec-based
architecture where AI writes JavaScript that runs directly in the
browser widget against a focused editor proxy.

Reimplemented from
[max/mcp-code-mode](https://github.com/tldraw/tldraw/tree/max/mcp-code-mode)
with a clean commit history.

Relates to #6832

**Key architectural changes:**

- **Exec-based model**: AI writes JavaScript code that executes in the
browser via a sandboxed `executeCode()` function, with access to the
full Editor API through a focused editor proxy
- **Focused editor proxy**: ES Proxy that transparently converts between
AI-friendly focused shapes (simple string IDs, named colors, pixel font
sizes) and tldraw's internal representation
- **Search tool**: AI can query the Editor API spec (extracted at build
time from TypeScript declarations) to discover methods, shape types, and
helpers
- **Server-widget callback bridge**: `PendingRequests` system enables
async request-response between the Cloudflare Worker and browser widget
- **Build-time API extraction**: TypeScript compiler API script reflects
on tldraw packages to generate searchable API metadata and method
classification maps

### Change type

- [x] `improvement`

### Test plan

1. Deploy the MCP app and connect from Claude Desktop
2. Ask AI to create shapes — should use exec tool with focused editor
proxy
3. Ask AI to search for Editor methods — should use search tool
4. Verify checkpoints persist across reconnections
5. Test in Cursor, VS Code, and ChatGPT hosts

### Release notes

- Migrate MCP app from shape CRUD tools to exec-based architecture for
more flexible AI canvas control

### Code changes

| Section        | LOC change       |
| -------------- | ---------------- |
| Apps           | +4504 / -2375    |
| Documentation  | +23 / -39        |
| Config/tooling | +9 / -134        |
@pull pull Bot locked and limited conversation to collaborators Apr 9, 2026
@pull pull Bot added the ⤵️ pull label Apr 9, 2026
@pull pull Bot merged commit 38e64fe into code:main Apr 9, 2026
@pull pull Bot had a problem deploying to bemo-canary April 9, 2026 21:13 Failure
@pull pull Bot had a problem deploying to deploy-production April 9, 2026 21:13 Failure
@pull pull Bot had a problem deploying to deploy-staging April 9, 2026 21:13 Failure
@pull pull Bot had a problem deploying to bemo-canary April 9, 2026 21:13 Failure
@pull pull Bot had a problem deploying to deploy-staging April 9, 2026 21:13 Error
@pull pull Bot had a problem deploying to vsce publish April 9, 2026 21:13 Failure
@pull pull Bot had a problem deploying to deploy-staging April 10, 2026 00:35 Failure
@pull pull Bot temporarily deployed to e2e-dotcom April 10, 2026 02:36 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant